home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2000 #1 / Amiga Plus CD - 2000 - No. 1.iso / Tools / Dev / Meshwriter / BigThing / bigthing.c next >
Encoding:
C/C++ Source or Header  |  1999-12-03  |  1.2 KB  |  52 lines

  1. /*
  2. ** ANSI standart includes
  3. */
  4. #include <stdio.h>
  5.  
  6. /*
  7. ** Amiga includes
  8. */
  9.  
  10. /*
  11. ** Amiga libraries includes
  12. */
  13.  
  14. /*
  15. ** Project includes
  16. */
  17. #include </meshlib.h>
  18.  
  19. /************************** test main *******************************/
  20. void main(void) {
  21.   ULONG mesh;
  22.   TOCLVertex v1,v2,v3;
  23.   ULONG ret,i;
  24.     
  25.   if((mesh = MWLMeshNew())!=0) {
  26.     printf("Object created\n");
  27.  
  28.     if(MWLMeshNameSet(mesh,"BigThing")) printf("Name not set\n");
  29.     else printf("Name set\n");
  30.  
  31.     printf("Adding triangles...");
  32.     v1.x=0.001,v1.y=0.001,v1.z=0.001;
  33.     for(i=0;i<65536;i++) {
  34.         v2.x=v1.x+0.001,v2.y=v1.y+0.001,v2.z=v1.z+0.001;
  35.         v3.x=v1.x+0.002,v3.y=v1.y+0.002,v3.z=v1.z+0.002;
  36.  
  37.         v1.x+=0.003,v1.y+=0.003,v1.z+=0.003;
  38.         MWLMeshTriangleAdd(mesh,0,&v1,&v2,&v3);
  39.     }
  40.     printf(" Done\n");
  41.  
  42.     printf("Total number of vertices : %ld\n",MWLMeshNumberOfVerticesGet(mesh));
  43.     printf("Total number of polygons : %ld\n",MWLMeshNumberOfPolygonsGet(mesh));
  44.     printf("Total number of materials : %ld\n",MWLMeshNumberOfMaterialsGet(mesh));
  45.     
  46.     printf("Triangles added\n");
  47.     if((ret=MWLMeshSave3D(mesh,T3DFREF4,"ram:pout.r4",NULL))) printf("Object not saved : %ld\n",ret);
  48.  
  49.     printf("Deleting mesh\n");
  50.     MWLMeshDelete(mesh);
  51.   }
  52. }